#ifndef FLOWNODE_H
#define FLOWNODE_H

#include <QtCore>
#include <QtWidgets>
#include "define.h"

class FlowEdge;


class FlowNode : public QGraphicsItem
{
public:
    FlowNode();
    ~FlowNode();

    QString id(){ return id_;}
    void setId(QString id){id_=id;}

    void setSelected(bool isSet);
    void setVoid(bool isVoid);

    void addEdge(FlowEdge *edge);
    QList<FlowEdge *> edges() const;
    bool removeEdge(FlowEdge *edge);

    void calculateForces();
    bool advance();

    int type() const override { return ItemNode; }

    QRectF boundingRect() const override;
    QPainterPath shape() const override;
protected:

    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

private:
    QList<FlowEdge *> edgeList;
    QPointF newPos;
    QString id_;
    bool isSelected_;
    bool isVoid_;
};

#endif // FLOWNODE_H
